import React from 'react';
import styles from './_layout.less';

class _layout extends React.Component {
  constructor(props) {
    super(props);
    props.history.listen(route => {
      //console.log('route.pathname', route.pathname);
      if (route.pathname.indexOf('fullPage2') < 0) {
        // 如果当前路由不是fullpage2
        // 销毁fullpage，不然导航原点会一直存在
        window.fullpage_api && window.fullpage_api.destroy('all');
      }
    });
  }

  shouldComponentUpdate() {
    return false;
  }

  render() {
    return <div className={styles.wrapper}>{this.props.children}</div>;
  }
}

export default _layout;
